/* Flash OS Routines (Automagically Generated)
 * Copyright (c) 2009-2015 ARM Limited
 */
#include "flash_blob.h"

static const uint32_t flash_code[] = {
    0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
    0x8F4FF3BF, 0xF3C04770, 0x28083084, 0x2104D302, 0x00D0EB01, 0x48544770, 0x60014952, 0x60014953,
    0x1F002100, 0x48506001, 0x68013008, 0x01F0F041, 0x484D6001, 0x68003010, 0xD4080680, 0xF245484C,
    0x60015155, 0x60412106, 0x71FFF640, 0x20006081, 0x48454770, 0x6801300C, 0x4100F041, 0x20006001,
    0xB5104770, 0x340C4C40, 0xF0406820, 0x60200004, 0xF4406820, 0x60203080, 0x1F22493D, 0x20AAF64A,
    0x6008E000, 0x03DB6813, 0x6820D4FB, 0x0004F020, 0x20006020, 0xB510BD10, 0xFFB5F7FF, 0x31084932,
    0xF042680A, 0x600A02F0, 0x1D0C2202, 0x68226022, 0xEA032378, 0x430200C0, 0x68206022, 0x3080F440,
    0x4A2B6020, 0x20AAF64A, 0x6010E000, 0x03DB680B, 0x6820D4FB, 0x0002F020, 0x68086020, 0x00F0F010,
    0x6808D004, 0x00F0F040, 0x20016008, 0xB5F0BD10, 0x1CC94C1D, 0x0103F021, 0x68233408, 0x03F0F043,
    0x23006023, 0x602B1D25, 0x2C01F240, 0xF64A4F18, 0xE02226AA, 0xEA43682B, 0x602B030C, 0x0E13F3C0,
    0xF04E6813, 0xF8CE6E00, 0xF3BF3000, 0xE0008F4F, 0x6823603E, 0xD4FB03DB, 0xF023682B, 0x602B0301,
    0xF0136823, 0xD0050FF0, 0xF0406820, 0x602000F0, 0xBDF02001, 0x1F091D00, 0x29001D12, 0x2000D1DA,
    0x0000BDF0, 0x45670123, 0x40023C04, 0xCDEF89AB, 0x40003000, 0x00000000
};

const program_target_t flash_algo = {
    0x20000037,  // Init
    0x20000073,  // UnInit
    0x20000083,  // EraseChip
    0x200000B7,  // EraseSector
    0x2000010F,  // ProgramPage

    // BKPT : start of blob + 1
    // RSB  : address to access global/static data
    // RSP  : stack pointer
    {
        0x20000001,
        0x20000C00,
        0x20001000
    },

    0x20000400,  // mem buffer location
    0x20000000,  // location to write prog_blob in target RAM
    sizeof(flash_code),  // prog_blob size
    flash_code,  // address of prog_blob
    0x00000400,  // ram_to_flash_bytes_to_be_written
};